﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using VictorBlaga.DocumentManagement.Infrastructure;

namespace VictorBlaga.DocumentManagement.Helpers
{
    public static class ModelStateExtensions
    {
        public static void AddModelErrors(this ModelStateDictionary state, IEnumerable<ValidationError> errors)
        {
            foreach (var error in errors)
            {
                state.AddModelError(error.PropertyName, error.ErrorMessage);
            }
        }
    }
}